All posts

Engineering Aug 12, 2026 6 min read

Keeping the script under one kilobyte

A tracking script is a tax on every page you ship. Here is how ours stays at 812 bytes, what we left out, and why the size is a promise rather than a boast.

Tomas Reilly

The Current script is 812 bytes after compression. The number is on the homepage because it is a promise: an analytics tool should never be the reason your Largest Contentful Paint got worse. Here is how it stays small.

One request, no library

There is no framework, no fetch polyfill, and no dependency of any kind. The script is one function that reads the page URL, the referrer, and the viewport width, and sends them in a single navigator.sendBeacon call. If the browser does not have sendBeacon it falls back to an image request, which is eleven more bytes.

No cookies, so no cookie code

A surprising amount of a typical analytics script is the machinery of identity: reading a cookie, writing a cookie, checking consent, refreshing an expiry. We do none of that. A visitor is a daily hash of a few request headers, computed on our servers, and the script never has to know who anyone is.

What we deliberately left out

  • Session replay. It is heavy, it is invasive, and it is not what most teams actually want.
  • Scroll depth. We tried it. Nobody made a decision because of it.
  • A queue. If the beacon fails, the visit is lost. We measured the loss at 0.2% and decided that honesty about the number was worth more than a retry buffer.

Web Vitals are a second script

The one thing that would not fit is performance measurement. Collecting LCP, INP, and CLS properly means listening to the PerformanceObserver for the life of the page. So that lives in a second script that loads after the page is idle, only on the sample of visits we need for a stable score. Turn it off and you are back to 812 bytes.

<script defer src="https://cdn.current.example/c.js" data-site="YOUR-SITE"></script>

That is the whole install. It has not changed since the first customer, and we intend to keep it that way.